﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core.Model;

namespace Core.Repository
{
    public interface IRepository<TEntity>
        where TEntity : class
    {
        TEntity Get(object id);

        void Add(TEntity entity);

        void Update(TEntity entity);

        void Delete(TEntity entity);

        IList<TEntity> Find(Func<TEntity, bool> expression);

        IList<TEntity> Find<Tkey>(Func<TEntity, bool> expression,
            Func<TEntity, Tkey>[] orderby, bool[] isDescending, int pageIndex, int pageCount);

        IList<TEntity> Find<Tkey>(Func<TEntity, bool> expression,
           Func<TEntity, Tkey>[] orderby, bool[] isDescending, int pageIndex, int pageCount, out int pages);

        IList<TEntity> Find<Tkey>(Func<TEntity, bool> expression,
           Func<TEntity, Tkey>[] orderby, bool[] isDescending, int pageIndex, int pageCount, out int pages,out int records);

        IList<TEntity> FindAll();
    }
}
